package com.payment.notify.receive.service.factory;

import com.payment.common.dto.notify.NotifyDto;
import com.payment.notify.receive.enums.NotifyReceiveEnum;
import com.payment.notify.receive.service.NotifyReceiveServiceTemplate;
import com.payment.notify.receive.utils.NotifyReceiveUtil;

/**
 * 类名：NotifyReceiveFactoryImpl.java<br>
 * 描述：<br>
 * 创建者：XINJF<br>
 * 创建日期：2018年5月9日下午11:21:46<br>
 * 版本：1.0<br>
 * 修改者：<br>
 * 修改日期：<br>
 */
public class NotifyReceiveResoFactory implements NotifyReceivResolveHandler {

	@Override
	public NotifyDto resolveReceiveMsg(NotifyReceiveEnum notifyReceiveEnum, String msg) {
		//模版
		NotifyReceiveServiceTemplate template = new NotifyReceiveServiceTemplate() {
			@Override
			public NotifyDto resolveSms(String msg) {
				NotifyDto notifyDto = NotifyReceiveUtil.resolveReceiveMsg(msg, notifyReceiveEnum.getReceiveDtoClass());
				return notifyDto;
			}
		};
		return (NotifyDto) template.execute(msg);
	}
}
